import request from '@/utils/request'

// 查询题库题目关联列表
export function listBankQuestion(query) {
  return request({
    url: '/exam/bankQuestion/list',
    method: 'get',
    params: query
  })
}

// 查询题库题目关联所有列表
export function listAllBankQuestion(query) {
  return request({
    url: '/exam/bankQuestion/listAll',
    method: 'get',
    params: query
  })
}

// 导出题库题目关联列表
export function exportBankQuestion(query) {
  return request({
    url: '/exam/bankQuestion/export',
    method: 'post',
    data: query
  })
}

// 查询题库题目关联详细
export function getBankQuestion(id) {
  return request({
    url: '/exam/bankQuestion/getInfo/' + id,
    method: 'get'
  })
}

// 新增题库题目关联
export function addBankQuestion(data) {
  return request({
    url: '/exam/bankQuestion/add',
    method: 'post',
    data: data
  })
}

// 修改题库题目关联
export function updateBankQuestion(data) {
  return request({
    url: '/exam/bankQuestion/edit',
    method: 'post',
    data: data
  })
}

// 删除题库题目关联
export function delBankQuestion(ids) {
  return request({
    url: '/exam/bankQuestion/remove/' + ids,
    method: 'get'
  })
}

// 获取题库题目列表（按顺序）
export function getQuestionsByBankId(bankId) {
  return request({
    url: '/exam/bankQuestion/getQuestionsByBankId/' + bankId,
    method: 'get'
  })
}

// 获取题库题目id列表（按顺序）
export function getQuestionIdsByBankId(bankId) {
  return request({
    url: '/exam/bankQuestion/getQuestionIdsByBankId/' + bankId,
    method: 'get'
  })
}

// 获取下一题
export function getNextQuestion(bankId, currentSortOrder) {
  return request({
    url: '/exam/bankQuestion/getNextQuestion/' + bankId + '/' + currentSortOrder,
    method: 'get'
  })
}

// 重新排序题库题目
export function reorderQuestions(bankId, questionIds) {
  return request({
    url: '/exam/bankQuestion/reorder/' + bankId,
    method: 'post',
    data: questionIds
  })
}

// 获取当前用户对指定题库的答题进度和记录
export function getUserProgressAndRecords(bankId) {
  return request({
    url: '/exam/bankQuestion/getUserProgressAndRecords/' + bankId,
    method: 'get'
  })
}
